﻿using GrainManage.Core.Access.Interfaces;
using GrainManage.Core.Service.Interfaces;
using GrainManage.Core.Util;
using System.Data;

namespace GrainManage.Core.Service
{
    public class WeatherService : BaseService, IWeatherService
    {
        public WeatherService(IAccess proc) :base(proc) { }

        public string GetPinyinByName(string name, bool allowUpward)
        {
            return Proc.ExecuteScalar(ProcConst.Weather_GetPinyinByName, name, allowUpward) as string;
        }

        public string GetParentPinyinByName(string name)
        {
            return Proc.ExecuteScalar(ProcConst.Weather_GetParentPinyinByName, name) as string;
        }

        public string GetCodeByName(string name)
        {
            return Proc.ExecuteScalar(ProcConst.Weather_GetCodeByName, name) as string;
        }

        public DataSet GetAllByName(string name)
        {
            return Proc.ExecuteQuery(ProcConst.Weather_GetByName, name);
        }

        public DataSet GetChildByCity(string city)
        {
            return Proc.ExecuteQuery(ProcConst.Weather_GetChildByCity, city);
        }
    }
}
